#include <stdio.h>
#include <string.h>
//open
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
//write
#include <unistd.h>


int main()
{
    //库函数
    printf("this is printf\n");
    fprintf(stdout, "this is fprintf\n");
    const char* str1 = "this is fwrite\n";
    fwrite(str1, strlen(str1), 1, stdout);

    //系统调用
    const char* str2 = "this is write\n";
    write(1, str2, strlen(str2));

    fork();
    return 0;
}

// int main()
// {
//     close(1);
//     int fd = open("log.txt", O_WRONLY | O_CREAT | O_APPEND, 0666);
//     //dup2(fd, 1);
    
//     //库函数
//     printf("this is printf\n");
//     printf("this is printf\n");
//     printf("this is printf\n");
//     //系统调用
//     const char* str = "this is write\n";
//     write(fd, str, strlen(str));

//     close(fd);
//     return 0;
// }
